/*
 * Created on 29.01.2006 by Volker
 *
 */
package de.partmaster.minesweeper.tool;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;


public class FileHexArrayPrinter {

    public static void print(InputStream inputStream) throws IOException {
        int read = -1;
        int count = 0;
        String separator = "";
        System.out.print("{ ");
        while ((read = inputStream.read()) != -1) {            
            System.out.print(separator+"(byte) 0x"+Integer.toHexString(read));
            separator = ", ";
            count++;
            if (count == 8) {
                System.out.println();
                count = 0;
            }
        }
        System.out.print(" }");
    }
    
    public static void main(String[] args) throws FileNotFoundException, IOException {
        System.out.println("private static byte[][] theCounterImageData = {");
        for (int i = 0; i < 10; i++) {            
            print(new FileInputStream(new File("icons/"+i+".gif")));
            System.out.println(", ");
        }
        System.out.println("}");
    }
}
